package com.ygqh.baby.controller.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBHelper {
	public static final String url = "jdbc:mysql://rm-2zeb4a61nhlpwg6c2.mysql.rds.aliyuncs.com:3306/yiigoo_db_pro?allowMultiQueries=true";
	public static final String name = "com.mysql.jdbc.Driver";
	public static final String user = "yiigoo_db_pro";
	public static final String password = "Adewe2@ADAWEW123";

	/*
	 * public static final String url =
	 * "jdbc:mysql://192.168.1.104:3306/yiigoo_dev?allowMultiQueries=true";
	 * public static final String name = "com.mysql.jdbc.Driver"; public static
	 * final String user = "root"; public static final String password =
	 * "yiigoo_dev";
	 */
	public Connection conn = null;

	public DBHelper() {
		try {
			Class.forName(name);// 指定连接类型
			conn = DriverManager.getConnection(url, user, password);// 获取连接
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void close() {
		try {
			this.conn.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
}
